]> permondes.de Git - Analog_Engine.git/blobdiff - scripts/TP1 04.12 Harmonic Oscillator.LACE
Potentials and Motion
[Analog_Engine.git] / scripts / TP1 04.12 Harmonic Oscillator.LACE
diff --git a/scripts/TP1 04.12 Harmonic Oscillator.LACE b/scripts/TP1 04.12 Harmonic Oscillator.LACE
new file mode 100644 (file)
index 0000000..89b0723
--- /dev/null
@@ -0,0 +1,31 @@
+# Harmonic Oscillator
+# A mass m is subject to a force F=-k*r.
+# What is the trajectory if the mass starts at position (a,0,0)?
+# How much time does it take to pass through zero?
+# What is the trajectory if it starts at (a,0,0) with velocity (0,v0,0)?
+# Compare to the case including gravity on earth in x direction
+# m*x'' = -k*x +       g
+# m*y'' = -k*y (z can be set to 0).
+
+coefficient.1(-1) -> -a    # (a,0,0), has to be negative because x' is negative
+coefficient.2     -> k/m_x # k/m for x
+coefficient.3(+1) -> v0    # (0,v0,0), has to be positive because y'' is positive
+coefficient.4     -> k/m_y # k/m for y, identical to k/m for x
+coefficient.5(-1) -> -g     # g
+
+iintegrate x'' -> -x'
+iintegrate -x' -> x
+   IC: -a
+cmultiply (k/m_x, x) -> k/m*x
+isum (k/m*x, -g) -> -k/m*x+g
+assign (-k/m*x+g) -> x''
+
+iintegrate y'' -> -y'
+   IC: v0
+iintegrate -y' -> y
+cmultiply (k/m_y, y) -> k/m*y
+invert (k/m*y) -> -k/m*y
+assign (-k/m*y) -> y''
+
+output x -> out.x
+output.y -> out.y